package com.eric.config.spi;



import org.apache.shardingsphere.spi.database.metadata.DataSourceMetaData;
import org.apache.shardingsphere.spi.database.type.BranchDatabaseType;
import org.apache.shardingsphere.spi.database.type.DatabaseType;
import org.apache.shardingsphere.underlying.common.database.type.dialect.MySQLDatabaseType;

import java.util.Collection;
import java.util.Collections;


/**
 * 扩展达梦数据库类型
 */
public class DMDatabaseType implements BranchDatabaseType {
    @Override
    public String getName() {
        return "DM";
    }

    @Override
    public Collection<String> getJdbcUrlPrefixAlias() {
        return Collections.emptyList();
    }

//    @Override
//    public Collection<String> getJdbcUrlPrefixes() {
//        return Collections.singleton(String.format("jdbc:%s:", this.getName().toLowerCase()));
//    }

    @Override
    public DataSourceMetaData getDataSourceMetaData(final String url, final String username) {
        return new DMDataSourceMetaData(url, username);
    }

    @Override
    public DatabaseType getTrunkDatabaseType() {
        return new MySQLDatabaseType();
    }
}
